package com.kl.rabbitmqprovider.test;

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] sticks = new int[n];
        int index = 0;
        for (int j = 0; j < n; j++) {
            sticks[index++] = scanner.nextInt();
        }
        for (int stick : sticks) {
            System.out.println(count(stick));
        }
    }

    public static int count(int i) {
        if (i < 4) {
            return 0;
        } else if (i < 7) {
            return 1;
        } else if (i < 10) {
            return 2;
        } else if (i < 12) {
            return 3;
        } else {
            int n = 12;
            int res = 4;
            while (i > n) {
                if ((res & 1) == 1) {
                    ++res;
                    n += 2;
                } else {
                    ++res;
                    n += 3;
                }
            }
            if (n != i) {
                --res;
            }
            return res;
        }
    }
}
